import java.io.*;

public class EnableDebugConsole {
    public static void main(String[] args) {
        File file = new File("D:/Desktop/options.ini");
        StringBuilder stringBuilder = new StringBuilder();
        String[] res;

        try (FileReader reader = new FileReader(file)) {
            while (true) {
                int ch = reader.read();
                if (ch == -1) {
                    break;
                }
                stringBuilder.append((char) ch);
            }
            res = stringBuilder.toString().split("\r\n");
            if (res[23].split("=")[1].equals("0")) {
                res[23] = "EnableDebugConsole=1";
            } else {
                res[23] = "EnableDebugConsole=0";
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        try (FileWriter writer = new FileWriter(file)) {
            for (String s : res) {
                writer.write(s + "\r\n");
            }
            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
